package com.feidee.fd.sml.algorithm.component.validation.assertion

import com.feidee.fd.sml.algorithm.component.validation.ValidationParam
import com.feidee.fd.sml.algorithm.util.Log
import com.google.gson.Gson
import org.apache.spark.sql.DataFrame

/**
  * @Author songhaicheng
  * @Date 2019/5/13 11:35
  * @Description
  * @Reviewer
  */
trait Assertion extends Log {
  val op: String
  val threshold: Any
  def assert(data: DataFrame, validationParam: ValidationParam): Boolean
  def apply(data: DataFrame, params: String, validationParam: ValidationParam): Boolean = {
    new Gson().fromJson(params, this.getClass).assert(data, validationParam)
  }
}

